<html>
<head><meta charset="utf-8"><title>How do I find the module a `Span` came from? · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20find.20the.20module.20a.20.60Span.60.20came.20from.3F.html">How do I find the module a `Span` came from?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="211397207"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20find%20the%20module%20a%20%60Span%60%20came%20from%3F/near/211397207" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20find.20the.20module.20a.20.60Span.60.20came.20from.3F.html#211397207">(Sep 27 2020 at 04:07)</a>:</h4>
<p><a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_span/hygiene/struct.SyntaxContext.html#method.outer_mark_with_data"><code>SyntaxContext::outer_mark_with_data</code></a> looks promising but it also says not to use it.</p>



<a name="211421128"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20find%20the%20module%20a%20%60Span%60%20came%20from%3F/near/211421128" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20find.20the.20module.20a.20.60Span.60.20came.20from.3F.html#211421128">(Sep 27 2020 at 15:27)</a>:</h4>
<p>actually I don't think <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_span/hygiene/struct.ExpnData.html"><code>ExpnData</code></a> has enough info, it has the crate but not the module</p>



<a name="211435579"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20find%20the%20module%20a%20%60Span%60%20came%20from%3F/near/211435579" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20find.20the.20module.20a.20.60Span.60.20came.20from.3F.html#211435579">(Sep 27 2020 at 21:35)</a>:</h4>
<p>What do you need it for?</p>



<a name="211435660"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20find%20the%20module%20a%20%60Span%60%20came%20from%3F/near/211435660" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20find.20the.20module.20a.20.60Span.60.20came.20from.3F.html#211435660">(Sep 27 2020 at 21:37)</a>:</h4>
<p>Looks like something rustdoc would want to implement its own incorrect version of name resolution.</p>



<a name="211438636"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20find%20the%20module%20a%20%60Span%60%20came%20from%3F/near/211438636" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20find.20the.20module.20a.20.60Span.60.20came.20from.3F.html#211438636">(Sep 27 2020 at 22:56)</a>:</h4>
<p>'incorrect' in the sense of inconsistent for sure <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span> <a href="https://github.com/rust-lang/rust/issues/77254">https://github.com/rust-lang/rust/issues/77254</a></p>



<a name="211438661"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/How%20do%20I%20find%20the%20module%20a%20%60Span%60%20came%20from%3F/near/211438661" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/How.20do.20I.20find.20the.20module.20a.20.60Span.60.20came.20from.3F.html#211438661">(Sep 27 2020 at 22:57)</a>:</h4>
<p>I think this doesn't need to go through spans though, if rustdoc weren't buggy and kept the <code>HirId</code> of the <code>use</code> it could use that instead: <a href="https://github.com/rust-lang/rust/pull/77276">https://github.com/rust-lang/rust/pull/77276</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>